<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>promise的异常穿透</title>
</head>
<body>
<script>
    let p = new Promise((resolve, reject) => {
        setTimeout(() => {
            reject('error')
        }, 1000)
    })

    p.then(value => {
        console.log(111)
    }).then(value => {
        console.log(222)
    }).then(value => {
        console.log(333)
    }).catch(reason => {
        console.log(reason)
    })
    /**
     * 这就叫异常穿透
     *    输出结果是第一个promise失败结果的值, 中间的环节直接跳过(即使中间出现了错误)
     *    第一个promise出现的错误由catch直接捕获
     */
</script>
</body>
</html>